<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        function fun (){
            // 依次输出参数的值
            for (var i = 0; i < arguments.length; i++){
            alert(arguments[i]);
            }
        }
        fun (1,2,3);

        function sum (){
            // 求所有参数的数值之和
            var result = 0;
            for (var i = 0; i < arguments.length; i++){
                if (typeof (arguments[i]) == "number"){
                    // 如果是数值
                result += arguments[i];
                }
            }
            alert (result);
        }
        sum (1,2,3,4,"abc",6,7,8,9);
    </script>
</head>
<body>
    
</body>
</html>